package cn.datax.service.workflow.service.impl;

import cn.datax.common.base.BaseServiceImpl;
import cn.datax.common.core.DataConstant;
import cn.datax.common.core.RedisConstant;
import cn.datax.common.exception.DataException;
import cn.datax.common.redis.service.RedisService;
import cn.datax.service.workflow.api.dto.BusinessDto;
import cn.datax.service.workflow.api.entity.BusinessEntity;
import cn.datax.service.workflow.api.entity.BusinessFlowEntity;
import cn.datax.service.workflow.api.vo.BusinessFlowVo;
import cn.datax.service.workflow.dao.BusinessDao;
import cn.datax.service.workflow.dao.BusinessFlowDao;
import cn.datax.service.workflow.mapstruct.BusinessFlowMapper;
import cn.datax.service.workflow.mapstruct.BusinessMapper;
import cn.datax.service.workflow.service.BusinessFlowStaticsService;
import cn.datax.service.workflow.service.BusinessService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * <p>
 * 业务流程配置表 服务实现类
 * </p>
 *
 * @author yuwei
 * @since 2020-09-22
 */
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class BusinessFlowServiceImpl extends BaseServiceImpl<BusinessFlowDao, BusinessFlowEntity> implements BusinessFlowStaticsService {

    @Autowired
    private BusinessFlowDao businessDao;

    @Autowired
    private BusinessFlowMapper businessMapper;

    /**
     * 获取API发布时间统计
     * @param queryWrapper
     * @return
     */
    public List<BusinessFlowEntity> getApiPublishList(QueryWrapper<BusinessFlowEntity> queryWrapper){
        return null;
    }

    /**
     * 获取API发布时间统计-线型图
     * @param beginTime
     * @return
     */
    public List<BusinessFlowEntity> getApiPublishStatics(String beginTime,String endTime){
        Map param = new HashMap();
        param.put("beginTime",beginTime);
        param.put("endTime",endTime);
        List<BusinessFlowEntity> list = businessDao.listApiFLowStatisticsByMap(param);
        return list;
    }
}
